import { request } from '@/utils/request';

interface loginResult {
  access_token: string;
  userId: number;
}

const prefix = '/api/console/auth';
export default {
  getCode: () => request.get({ url: `${prefix}/code` }, { withToken: false }),
  login: (data: any) =>
    request.post<loginResult>({ url: `${prefix}/login`, data }, { withToken: false, showMsg: false }),
  logout: () => request.post({ url: `${prefix}/logout` }),
  dashboard: () => request.get({ url: '/api/console/dashboard' }),
  refresh: (data: any) => request.post({ url: `${prefix}/refresh`, data }, { withToken: false }),
  uploadUrl: '/api/console/attachement/upload',
};
